﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "TranslatorManager.h"
#include "GapViewAndPositionReference.h"
#include "ElementCreationOptions.h"
#include "IEntity.h"
#include "Coordinate3d.h"
//#include"GapCoordinate.h"
namespace gcmp
{
    class IDocument;
    class ElementId;
    class IModelView;
    class IParameter;
    class IGraphicsElementShape;
    class Coordinate3d;
}

namespace gap
{
    enum class CoordinateType : int32_t//坐标类型
    {
        System = 1,            ///< 总图
        CustomInSystem,         ///< 总图子项1
        Custom,                   //其他
    };
    enum class CoordinateGridCurveType
    {
        Line = 0,
        Arc
    };
    struct CoordinateGridParaInput
    {
        CoordinateGridParaInput()
        {
           CurveType = CoordinateGridCurveType::Arc;
           Text = L"1";
           StartTagVisible = true;
           EndTagVisible = true;
           StartExtension = 500.0;
           EndExtension = 1000.0;
           TagDiameter = 1000.0;
        }
        CoordinateGridCurveType CurveType;
        std::wstring Text;                       //轴线名字
        gcmp::Vector3d CurveStartPt;
        gcmp::Vector3d CurveMidPt;
        gcmp::Vector3d CurveEndPt;
        bool StartTagVisible = true;
        bool EndTagVisible = true;
        double StartExtension = 500.0;
        double EndExtension = 1000.0;
        double TagDiameter = 1000.0;
    };
    struct CoordinateInput
    {
        CoordinateInput()
        {
            Angle = gcmp::Constants::MATH_PI_2;
            Text = GBMP_TR(L"项目坐标");
            CoordinatePositionType = CoordinateType::System;
            Document = nullptr;
            bDisplayGrid = false;
            NorthSouth = 0.0;
            EastWest = 0.0;
            Altitude = 0.0;
            CreationOptions = gcmp::ElementCreationOptions::Normal;
        }
        std::wstring Text;                       //项目名称
        double  Angle;                          //旋转角度
        double  NorthSouth;                     //南/北
        double  EastWest;                       //东/西
        double  Altitude;                       //高程
        CoordinateType CoordinatePositionType;    //坐标类型
        gcmp::IDocument* Document;             // 文档
        bool bDisplayGrid;
        std::vector<CoordinateGridParaInput> vcGridPara;          // 轴网数据参数
        gcmp::ElementCreationOptions CreationOptions;
    };
}
namespace gap
{
    struct CoordinateInput;
    class CoordinateGridPara;
    class GAP_VIEW_AND_POSITION_REFERENCE_EXPORT ICoordinate :public IEntity
    {
        DEFINE_CAST_DERIVED(gap::ICoordinate, gap::IEntity)
    public:
        static ICoordinate* Create(const CoordinateInput& pInputData);
        static const ICoordinate* Get(const gcmp::IDocument* pDoc, const gcmp::ElementId& elemId);
        static ICoordinate* GetFW(gcmp::IDocument* pDoc, const gcmp::ElementId& elemId);
        static gcmp::UniIdentity GetImplementationUid();
        virtual bool SetType(CoordinateType type) = 0;
        virtual CoordinateType GetType() const = 0;
        //获取是否显示轴网
        virtual bool SetDisplayGrid(bool bDisplayGrid) = 0;
        virtual bool GetDisplayGrid() const = 0;
        //设置角度
        virtual bool SetAngle(double angle) = 0;
        virtual double GetAngle() const = 0;
        //轴网数据包
        virtual std::vector<CoordinateGridParaInput> GetGridPara()const = 0;
        virtual bool SetGridPara(std::vector<CoordinateGridParaInput> val) = 0;

        //获取文档
        virtual gcmp::IDocument* GetDocument() const = 0;
        //获取Text内容
        virtual const std::wstring& GetText() const = 0;
        virtual bool SetText(const std::wstring& val) = 0;
        virtual double GetNorthSouth() const = 0;
        virtual bool SetNorthSouth(double val) = 0;
        virtual double GetEastWest() const = 0;
        virtual bool SetEastWest(double val) = 0;
        virtual double GetAltitude() const = 0;
        virtual bool SetAltitude(double val) = 0;

        virtual gcmp::Coordinate3d GetGeometryCoordinate() const = 0;
        virtual gcmp::Vector3d GetSnapPoint() const = 0;
    };
}
